<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>fiction post - Create Article</title>

<script type="text/javascript">
<!--
	function selectAction() {
		var articleId = document.getElementsByName("articleId")[0].value;
		if (articleId == "" || articleId == null) {
			document.forms[0].action = "/fpostWeb/createArticleAction.do?";
		} else {
			document.forms[0].action = "/fpostWeb/updateArticleAction.do?articleId=" + articleId;
		}
	}
//-->
</script>
</head>
<body>
	<table border="0" width = "80%" align="center">
		<tr>
			<td><jsp:include page="header.jsp" /></td>
		</tr>
		<tr>
			<td>
				<b>Create Article</b><br><br>
				<div style="color: red">
					<html:errors />
				</div> 
				<html:hidden name="createArticleForm" property="articleId" /> 
				<html:form action="/createArticleAction">
					<table>
						<tr>
							<td>Article type :</td>
							<td><html:select name="createArticleForm" property="articleTypeId">
									<html:option value="0">Select Type</html:option>
									<html:optionsCollection name="createArticleForm"
										property="articleTypeDTOList" label="articleType"
										value="articleTypeId"></html:optionsCollection>
								</html:select></td>
						</tr>
						<tr>
							<td>Title :</td>
							<td><html:text size="100" name="createArticleForm" property="title" /> 
								<html:hidden name="createArticleForm" property="title" />
							</td>
						</tr>
						<tr>
							<td>Author :</td>
							<td>
								<bean:write name="createArticleForm" property="authorFirstName" /> 
								<html:hidden name="createArticleForm" property="authorFirstName" /> 
								<bean:write name="createArticleForm" property="authorLastName" /> 
								<html:hidden name="createArticleForm" property="authorLastName" /> 
								(<bean:write name="createArticleForm" property="authorUsername" />) 
								<html:hidden name="createArticleForm" property="authorUsername" />
							</td>
						</tr>
						<tr>
							<td>Summary :</td>
							<td>
							<html:textarea cols="80" rows="3" name="createArticleForm" property="summary" /> 
							<html:hidden name="createArticleForm" property="summary" />
							</td>
						</tr>
						<tr>
							<td>Body :</td>
							<td><html:textarea cols="80" rows="10"
									name="createArticleForm" property="body" /> <html:hidden
									name="createArticleForm" property="body" /></td>
						</tr>
						<tr>
							<td>Keywords :</td>
							<td><html:text size="100" name="createArticleForm"
									property="keywords" /> <html:hidden name="createArticleForm"
									property="keywords" /></td>
						</tr>
						<tr>
							<td></td>
							<td>
								<html:submit onclick="selectAction();" />
								<html:reset />
							</td>
						</tr>
					</table>
				</html:form>
			</td>
		</tr>
		<tr>
			<td>				
				<jsp:include page="footer.jsp" />	
			</td>
		</tr>		
	</table>
</body>
</html>
